package com.veetao.api.model;

import java.lang.reflect.Method;
import java.lang.reflect.Type;

import com.veetao.api.annotation.McpMethod;
import com.veetao.api.annotation.McpReq;

/**
 * 
 * @author guohongtao
 * @date 2017年9月13日
 */
public class ApiCommand {
	public ApiCommand() {
		super();
	}
	
	private ApiFacade targetObject;
	private Method method;
	private McpMethod mcpMethod;

	private Class<?> reqClass;

	private Class<?> respClass;

	private Type mcpReqType;

	private McpReq mcpReq;

	private transient boolean isVoidMethod;
	
	private boolean withRawReqAndResp;
	public ApiCommand(ApiFacade targetObject, Method method) {
		super();
		this.targetObject = targetObject;
		this.method = method;
	}
	

	public ApiFacade getTargetObject() {
		return targetObject;
	}

	public void setTargetObject(ApiFacade targetObject) {
		this.targetObject = targetObject;
	}

	public Method getMethod() {
		return method;
	}

	public void setMethod(Method method) {
		this.method = method;
	}


	public McpMethod getMcpMethod() {
		return mcpMethod;
	}


	public void setMcpMethod(McpMethod mcpMethod) {
		this.mcpMethod = mcpMethod;
	}


	public Class<?> getReqClass() {
		return reqClass;
	}


	public void setReqClass(Class<?> reqClass) {
		this.reqClass = reqClass;
	}


	public Class<?> getRespClass() {
		return respClass;
	}


	public void setRespClass(Class<?> respClass) {
		this.respClass = respClass;
	}


	public Type getMcpReqType() {
		return mcpReqType;
	}


	public void setMcpReqType(Type mcpReqType) {
		this.mcpReqType = mcpReqType;
	}


	public McpReq getMcpReq() {
		return mcpReq;
	}


	public void setMcpReq(McpReq mcpReq) {
		this.mcpReq = mcpReq;
	}


	public boolean isVoidMethod() {
		return isVoidMethod;
	}


	public void setVoidMethod(boolean isVoidMethod) {
		this.isVoidMethod = isVoidMethod;
	}


	public boolean isWithRawReqAndResp() {
		return withRawReqAndResp;
	}


	public void setWithRawReqAndResp(boolean withRawReqAndResp) {
		this.withRawReqAndResp = withRawReqAndResp;
	}


	public boolean notNeedParameter() {
		return this.getReqClass() == null && this.getMcpReq() == null;
	}
}
